const arr: string[] = [];
for (let i = 97; i < 97 + 26; i++) {
  arr.push(String.fromCharCode(i));
}
for (let i = 65; i < 65 + 26; i++) {
  arr.push(String.fromCharCode(i));
}
for (let i = 0; i < 10; i++) {
  arr.push(`${i}`);
}

/**
 * @description 生成随机数
 * @param num
 * @returns
 */
export const random = (num: Number = 32): string => {
  let result: string = '';
  const len = arr.length - 1;
  for (let i = 0; i < num; i++) {
    const index = Math.ceil(Math.random() * len);
    result += arr[index];
  }
  return result;
};
